# -*- coding: utf-8 -*-
from django.db import models
from okuz.profile.models import Profile


#
# Uwagi do wizyty
class Comment (models.Model):
	#oid = models.PositiveIntegerField (primary_key = True);
	name = models.CharField (max_length = 511);

	def __unicode__(self):
		return u"%s" % self.name;

#
# Wizyty pacjenta
class Visit (models.Model):
	date = models.DateField (verbose_name=u"Data wizyty");
	profile = models.ForeignKey (Profile, related_name = "visits", verbose_name=u"Profil");
	comment = models.ForeignKey (Comment, null=True, blank=True, related_name = "comments", verbose_name=u"Uwagi");
	leave_from = models.DateField (null=True, blank=True, verbose_name=u"Zwolnienie od");
	leave_to = models.DateField (null=True, blank=True, verbose_name=u"Zwolnienie do");
	recommendation = models.ForeignKey (Comment, null=True, blank=True, related_name = "recommendations", verbose_name=u"Zalecenia");

	class Meta:
		verbose_name = u"Wizyta pacjenta";
		ordering = ['-date'];

	def __unicode__(self):
		return u"%s %s %s" % (self.date, self.profile.first_name, self.profile.last_name);

